<template>
  <section class="page-container">
    <el-form 
      :model="ruleForm" 
      :label-position="labelPosition" 
      :rules="rules" 
      ref="ruleForm" 
      label-width="100px" 
      class="demo-ruleForm">
      <el-form-item label="工作打分" prop="work_fraction">
        <el-input-number v-model="ruleForm.work_fraction"  :min="1" :max="150"></el-input-number>
      </el-form-item>
       <el-form-item label="创新打分" prop="innovate_fraction">
        <el-input-number v-model="ruleForm.innovate_fraction"  :min="1" :max="150"></el-input-number>
      </el-form-item>
       <el-form-item label="稳定打分" prop="stabilize_fraction">
        <el-input-number v-model="ruleForm.stabilize_fraction"  :min="1" :max="150"></el-input-number>
      </el-form-item>
      <el-form-item label="婚姻打分" prop="marriage_fraction">
        <el-input-number v-model="ruleForm.marriage_fraction"  :min="1" :max="150"></el-input-number>
      </el-form-item>
      <el-form-item label="健康打分" prop="fitness_fraction">
        <el-input-number v-model="ruleForm.fitness_fraction"  :min="1" :max="150"></el-input-number>
      </el-form-item>
      <el-form-item label="收入打分" prop="income_fraction">
         <el-input-number v-model="ruleForm.income_fraction"  :min="1" :max="150"></el-input-number>
      </el-form-item>
       <el-form-item label="能力打分" prop="capacity_fraction">
        <el-input-number v-model="ruleForm.capacity_fraction"  :min="1" :max="150"></el-input-number>
      </el-form-item>
      <el-form-item label="工作分类" prop="type">
        <el-select v-model.number="ruleForm.type" placeholder="请选择工作建议">
          <el-option
            v-for="item in categories"
            :key="item.id"
            :label="item.name"
            :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
        <el-button @click="resetForm('ruleForm')">重置</el-button>
      </el-form-item>
    </el-form>
  </section>
</template>
<script>
  import Tinymce from '@/components/tinymce/Editor'
  export default {
    data () {
      return {
        labelPosition: 'right',
        ruleForm: {},
        tempData: {},
        categories: {}
      }
    },
    components: { Tinymce },
    methods: {
      _getCategories () {
        this.$http.get('/yiJingIntroductionSort').then((response) => {
          this.categories = response.data
        }).catch((error) => {
          console.log(error)
        })
      },
      _createOrEdit () {
        this.$http({
          method: this.isEdit ? 'put' : 'post',
          url: this.isEdit ? '/yijing/' + this.ruleForm.id : '/yijing',
          data: this.ruleForm
        }).then((response) => {
          this.$message.success('保存成功')
          this.$router.push('/changes/index')
        }).catch((error) => {
          console.log(error)
        })
      }
    },
    computed: {
    },
    watch: {
    },
    mounted () {
      this._getCategories()
    }
  }
</script>
<style lang="scss" scoped>
  .page-container {
    padding: 20px 50px;
  }
</style>